Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add to PipelineExecutionRolePermissions to allow stack deletion #3213

Merged
merged 102 commits into from
Oct 7, 2021
Merged

Add to PipelineExecutionRolePermissions to allow stack deletion #3213

merged 102 commits into from
Oct 7, 2021

Conversation

brianz
Copy link
Contributor

@brianz brianz commented Aug 30, 2021

Why

The PipelineExecutionRole is assumed by the PipelineUser when deploying CI/CD pipelines.
This role doesn't have permission to delete stacks via sam delete. This means that any stacks
created need to be deleted manually. In order to support automated stack deletions for feature
branches, this role needs a few extra permissions.

This change is needed to support the this PR in the sam pipeline
templates:

aws/aws-sam-cli-pipeline-init-templates#42

How

  • Add three additional IAM permissions which allow the sam delete command to work as
    expected in PipelineExecutionRolePermissions.

Next Steps

Which issue(s) does this change fix?

Why is this change necessary?

How does it address the issue?

What side effects does this change have?

Checklist

  • Add input/output type hints to new functions/methods
  • Write design document (Do I need to write a design document?)
  • Write unit tests
  • Write/update functional tests
  • Write/update integration tests
  • make pr passes
  • make update-reproducible-reqs if dependencies were changed
  • Write documentation

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

sanathkr and others added 30 commits November 29, 2018 12:44
chore: Version bump SAM CLI to 0.14.1 (#1082)
chore: Release SAM CLI v0.22
aws-sam-cli-bot and others added 18 commits February 25, 2021 11:49
Why
---

The `PipelineExecutionRole` is assumed by the `PipelineUser` when deploying CI/CD pipelines.
This role doesn't have permission to delete stacks via `sam delete`. This means that any stacks
created need to be deleted manually. In order to support automated stack deletions for feature
branches, this role needs a few extra permissions.

This change is needed to support the this PR in the sam pipeline
templates:

aws/aws-sam-cli-pipeline-init-templates#42

How
---

- Add three additional IAM permissions which allow the `sam delete`
command to work as expected in `PipelineExecutionRolePermissions`.

Next Steps
----------

- After this is merged, [this PR in the Pipeline templates for GitHub
Actions](aws/aws-sam-cli-pipeline-init-templates#42)
can be merged.
@aahung aahung changed the base branch from master to develop October 6, 2021 21:13
@aahung aahung self-requested a review October 6, 2021 21:58
Copy link
Contributor

@aahung aahung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add one permission BatchDeleteImage to

          - Fn::If:
            - ShouldHaveImageRepository
            - Effect: "Allow"
              Action:
                - "ecr:GetDownloadUrlForLayer"
                - "ecr:BatchGetImage"
                - "ecr:BatchCheckLayerAvailability"
                - "ecr:PutImage"
                - "ecr:InitiateLayerUpload"
                - "ecr:UploadLayerPart"
                - "ecr:CompleteLayerUpload"
              Resource:
                Fn::If:
                  - MissingImageRepository
                  - !GetAtt ImageRepository.Arn
                  - !Ref ImageRepositoryArn

Based on PR feedback, allow for this role to delete a list of ImageIds
by adding `ecr:BatchDeleteImage` to the Pipeline role.
@aahung aahung merged commit 9a3aee3 into aws:develop Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants